# pip install opencv-python

import cv2

img = cv2.imread('./1.jpg',flags=cv2.IMREAD_COLOR)

# 定义新的宽度和高度
new_width = 800
new_height = 800

# 调整图像尺寸
resized_image = cv2.resize(img, (new_width, new_height))

# 图片增加2条线，一条水平居中，一条垂直居中
# for i in range(len(resized_image)):
#     colCenter = int(len(resized_image[0])/2)
#     resized_image[i][colCenter] = [0,0,255] # BGR颜色 蓝绿红
#     if(i<len(resized_image[0])):
#         center= int(len(resized_image)/2)
#         resized_image[center][i] = [0,0,255]


# 创建一个名为"Resized Image"的窗口，并显示修改后的图像
cv2.namedWindow("Resized Image", cv2.WINDOW_NORMAL)
cv2.imshow("Resized Image", resized_image)

# cv2.imshow('myImg',img) # 查看图片
cv2.waitKey(0) # 任意按钮
# cv2.destroyAllWindows() # 关闭窗口